@extends('admin.layouts.base')

@section('title','控制面板')

@section('pageHeader','控制面板')

@section('pageDesc','DashBoard')

@section('content')
    <div class="main animsition">
        <div class="container-fluid">

            <div class="row">
                <div class="">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">导入模板</h3>
                        </div>
                        <div class="panel-body">

                            @include('admin.partials.errors')
                            @include('admin.partials.success')
                            <form class="form-horizontal" role="form" method="POST"
                                  action="/admin/templates/import" enctype="multipart/form-data">
                                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                             
								<div class="form-group">
									<label for="tag" class="col-md-3 control-label">选择模板</label>
									<div class="col-md-5">
										<input type="file" accept="*.html,*.htm,*.txt,*.xhtml" class="form-control" name="templates[]" id="tag" multiple="multiple"/>
										<span style="color:red;">温馨提示：可选多个模板，文件名就是模板名称。</span>
									</div>
								</div>
								@if(auth()->user()->id === 1)
								<div class="form-group">
									<label for="tagUid" class="col-md-3 control-label">所属用户</label>
									<div class="col-md-5">
										<select class="form-control" name="uid" id="tagUid"
												onchange="$('#username').val($(this).find('option:selected').text());">
											@foreach ($userList as $id=>$name)
												<option value="{{ $id }}" @if ($id === $uid) selected="selected" @endif>{{ $name }}</option>
											@endforeach
										</select>
										<input type="hidden" id="username" name="username" value="{{ empty($username) ? $userList[1] : $username}}">
									</div>
								</div>
								@else
									<input type="hidden" id="username" name="username" value="{{auth()->user()->name}}">
								@endif
								<div class="form-group">
									<label for="tagMark" class="col-md-3 control-label">备注</label>
									<div class="col-md-5">
										<textarea class="form-control" id="tagMark" name="mark"></textarea>
									</div>
								</div>

                                <div class="form-group">
                                    <div class="col-md-7 col-md-offset-3">
                                        <button type="submit" class="btn btn-primary btn-md">
                                            <i class="fa fa-plus-circle"></i>
                                            保存
                                        </button>
                                    </div>
                                </div>

                            </form>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop